package auth

import (
	"crypto/rand"
	"encoding/hex"
)

const (
	tokenLen            = 32
	hour                = 3600
	TokenTimeout        = hour * 2
	RefreshTokenTimeout = hour * 24
)

func GenerateToken() (token string, err error) {
	b := make([]byte, tokenLen)
	_, err = rand.Read(b)
	if err != nil {
		return "", err
	}
	token = hex.EncodeToString(b)
	return token, nil
}
